<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 创建Symbol
        let s = Symbol();
        console.log(s, typeof s);//Symbol()  'symbol'
        let s2 = Symbol('你好')
        let s3 = Symbol('你好')
        console.log(s2 === s3);//false
        //Symbol.for创建
        let s4 = Symbol.for("很好");
        let s5 = Symbol.for("很好");
        console.log(s4, typeof s4);//Symbol(很好)    'symbol'
        console.log(s4 === s5);//true

        // Symbol注意：不能与其他数据进行运算
        // let result = s + '100';//error
        // let result = s * 100;//error
        // let result = s + s;//error

        // js 七种数据类型

        let game = {
            name:"俄罗斯方块",
            up:"俄罗斯方块up",
            down:"俄罗斯方块down"
        };

        // // 声明一个对象
        // let methods = {
        //     up: Symbol(),
        //     down: Symbol()
        // };
        // game[methods.up] = function () {
        //     console.log("我可以改变形状");
        // }
        // game[methods.down] = function () {
        //     console.log("我可以快速下降");
        // }
        // console.log(game);

        let youxi = {
            name:"狼人杀",
            [Symbol('say')]:function(){
                console.log("我可以发言");
            },
            [Symbol('zibao')]:function(){
                console.log("我可以自爆");
            },
        }
        console.log(youxi);

    </script>
</body>

</html>